If using PHPUnit version 3.5.0 or later, make use of its Autoloader
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 16 Oct 2010 10:39:00 +0000 (10:39 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 16 Oct 2010 10:39:00 +0000 (10:39 +0000)
maintenance/tests/phpunit/phpunit.php

index c643a44..1f20259 100755 (executable)
@@ -23,6 +23,12 @@ $wgLocaltimezone = 'UTC';
 // To prevent tests from failing with SQLite, we need to turn database caching off
 $wgCaches[CACHE_DB] = false;
 
-require_once( 'PHPUnit/TextUI/Command.php' );
+require_once( 'PHPUnit/Runner/Version.php' );
+if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) {
+       # PHPUnit 3.5.0 introduced a nice autoloader based on class name
+       require_once( 'PHPUnit/Autoload.php' );
+} else {
+       # Keep the old pre PHPUnit 3.5.0 behaviour for compatibility
+       require_once( 'PHPUnit/TextUI/Command.php' );
+}      
 PHPUnit_TextUI_Command::main();
-